
def find_threshold(value_list, count_list, area_limit):
    new_value_list, new_count_list = zip(*sorted(zip(value_list, count_list)))

    sum_count = 0
    threshold = 0
    for value, count in zip(new_value_list[::-1], new_count_list[::-1]):
        sum_count += count
        if sum_count > area_limit:
            threshold = value
            break
    return threshold

if __name__ == "__main__":
    value_list = [3, 5, 4, 2]
    count_list = [84, 123, 23, 49]
    area_limit = 200
    threshold = find_threshold(value_list, count_list, area_limit)
    print(threshold)

